Ext.define('AmpleHarvest.objects.forms.irtCommon.requestInformation.requestSpecific.requestAIRS',
{
	extend			: 'Ext.form.Panel',
	alias			: 'widget.ampleharvest-objects-forms-irtcommon-requestinformation-requestspecific-requestairs',
	requires		:
	[
		"Ext.form.field.Text", 
		"Ext.form.FieldSet",
		"Ext.form.field.Date", 
		'Ext.layout.container.VBox',
		'Ext.layout.container.HBox',
	],
		
	statics			: {},
	itemId			: 'requestairs_panel',
	

	hideClassifiedSourceAdditionalInfo : function()
	{
		this.classifiedSourceInformation.hide();
		this.classifiedSourceInformation.getComponent("additionalinfo_items").getComponent("explanation_textarea").disable();
	},
	
	showClassifiedSourceAdditionalInfo : function()
	{
		this.classifiedSourceInformation.getComponent("additionalinfo_items").getComponent("explanation_textarea").enable();
		this.classifiedSourceInformation.show();
	},
	
	initComponent	: function()
	{
		//-------------------- Classified Source --------------------//
		this.airsClassifiedSource = Ext.create("Ext.form.FieldSet",
		{
			title		: "Classified Source",
			collapsible	: false,
			labelWidth	: 70,
			width		: 275,
			layout		: 
			{
				type	: 'vbox',
		        align	: 'left'
			}
		});
		
		this.airsClassifiedSourceFieldContainer = Ext.create('Ext.form.Panel',
		{
			border		: false,
			labelWidth	: 70,
			width		: 250,
			items: [
			{
				xtype : 'checkboxgroup',
				allowBlank : false,
			    defaultType		: 'radiofield',
			    defaults		: { flex : 1 },
			    layout			: { type : 'hbox' },
			    
			    items: 
			    [
			        {
			            boxLabel	: 'No',
			            name: 'c_source', //PHP Column label
			            inputValue	: 0,
	                    handler: function(checkbox, checked) {
	                		if(checked){
	                			this.up('ampleharvest-objects-forms-irtcommon-requestinformation-requestspecific-requestairs').hideClassifiedSourceAdditionalInfo();
	                		}
	                	}
			        },
			        {
			            boxLabel	: 'Yes',
			            name: 'c_source', //PHP Column label
			            inputValue	: 1,
	                    handler: function(checkbox, checked) {
	                		if(checked){
	                			this.up('ampleharvest-objects-forms-irtcommon-requestinformation-requestspecific-requestairs').showClassifiedSourceAdditionalInfo();
	                		}
	                	}
			        },
			    ]
			}]
		});
		
	
		
		this.classifiedSourceInformation = Ext.create("Ext.form.FieldSet",
		{
			title		: "Additional Information",
			collapsible	: false,
			labelWidth	: 70,
			width		: 250,
			itemId		: 'additionalinfo_fieldset',
			hidden		: true,
			items: [
			{
				border		: false,
				itemId			: 'additionalinfo_items',
			    layout			: { type : 'vbox' },
			    align			: 'center',
			    items: 
			    [
			        {
			            xtype: 'text',
				        text: "OBTAIN TEXT FROM HIGH SIDE. \nExplain:"
			        },
			        {
			        	xtype     : 'textarea',
			        	itemId	  : 'explanation_textarea',
						grow      : true,
			            name	  : 'c_source_info', //PHP Column label
						anchor    : '100%',
						width		: 225,
						allowBlank	: false
			        },
			    ]
			}]
		});

		this.airsClassifiedSource.add( this.airsClassifiedSourceFieldContainer );
		this.airsClassifiedSource.add(this.classifiedSourceInformation);
		
		this.items = [ this.airsClassifiedSource ]
		
	    this.callParent();
	}
});